import request from '@/utils/axios';


//查找榜单
export function RankingInfoAllApi(topic?: string, id?: number) {
  return request({
    url: '/getRankingInfoAll',
    method: 'get',
    params: { topic, id }
  });
}
//创建榜单
interface CreateRankingParams {
  topic: string;
  coverImage: string;
  startTime: string;
  endTime: string;
  introduce: string;
}
export function createRankingApi(params: CreateRankingParams) {
  return request({
    url: '/createRanking',
    method: 'post',
    data: params
  });
}
//删除榜单
export function deleteRankingApi(params: { id: number }) {
  return request({
    url: '/deleteRanking',
    method: 'delete',
    params
  });
}
//更新榜单
interface updateVo{
  id:number,
  topic:string,
  coverImage:string,
  startTime:string,
  endTime:string,
  introduce:string
}
export function updateRankingAoi(data:updateVo){
  return request({
    url:'/updateRanking',
    method:'put',
    data
  })
}

/**
 * 获取评论
 */
export interface PageVo {
  page: number;
  pageSize: number;
}

export function getCommentsApi(params: PageVo) {
  return request({
    url: '/getCommentsPage',
    method: 'get',
    params
  });
}
/**
 * 修改评论状态
 */
export interface statuVO {
  commentId: number;
  status: number;
}

export function updateCommentsApi(params: statuVO) {
  return request({
    url: '/updateCommentsStatus',
    method: 'put',
    params
  });
}
/**
 * 删除评论
 * @param params 
 * @returns 
 */
export function deleteCommentsApi(commentId: number) {
  return request({
    url: '/deleteComments',
    method: 'delete',
    params: { commentId }
  });
}
